#include "Student.h"
#include <iostream>

// 初始化成员列表
Student::Student(int id, const std::string &name, float score) : id(id), name(name), score(score) {}

Student::Student() : id(0), name("null"), score(0.0) {}

int Student::getId() const
{
    return id;
}

std::string Student::getName() const
{
    return name;
}

float Student::getScore() const
{
    return score;
}

void Student::setName(const std::string &newName)
{
    name = newName;
}

void Student::setScore(float newScore)
{
    score = newScore;
}
// 重载<<运算符，使其能让Student类的信息链式输出到std::ostream中
std::ostream &operator<<(std::ostream &os, const Student &student)
{
    // TODO: 在此处插入 return 语句
    os << "学号: " << student.id
       << ", 姓名: " << student.name
       << ", 成绩: " << student.score;
    return os;
}